#include"preCmpH.h"
#include"UIImage.h"
#include"UIRenderer.h"

BEGIN_NAMESPACE(ui_manager)
BEGIN_NAMESPACE(ui_graphics)

UIImage::UIImage()
	: w_(0),
	h_(0),
	id_(0),
	format_(0),
	type_(0),
	name_()
{
}
UIImage::UIImage(const UIImage& img)
: w_(img.w_)
, h_(img.h_)
, id_(img.id_)
, format_(img.format_)
, type_(img.type_)
, name_(img.name_)
{
}
UIImage::~UIImage()
{
	if(id_ != 0){
		throw UIException("UIImage not cleared before destructor");
	}
}
void UIImage::Clear()
{
	UIRenderer::getInstance().ClearImage(*this);
}

UIImage& UIImage::operator=( const UIImage& img )
{
	if(this == &img){
		return *this;
	}
	Clear();
	w_ = img.w_;
	h_ = img.h_;
	id_ = img.id_;
	format_ = img.format_;
	type_ = img.type_;
	name_ = img.name_;
}

END_NAMESPACE // ui manager
END_NAMESPACE // ui graphics